using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CMS_SUN_IF_Extraction
{
    public partial class frmVerification_SumAmt_NotTally_Form : Form
    {
        private BAL bao = new BAL();
        private DataTable tblSysCtrl = null;
        public frmVerification_SumAmt_NotTally_Form()
        {
            InitializeComponent();
        }

        private void Verification_SumAmt_NotTally_Form_Load(object sender, EventArgs e)
        {
            label2.Text = "Sum of Proc,Phar,Service && VAT Tax does not Tally \n with TOTAL Amount";

            /*txtVATCenter.Text = GlobalClass.gCurr_VAT_Center;
            txtDateFrom.Text = GlobalClass.gCurr_Start_ExtractDate;
            txtDateTo.Text = GlobalClass.gCurr_End_ExtractDate;*/
            
            tblSysCtrl = bao.get_tbl_SysControl();
            if (tblSysCtrl != null && tblSysCtrl.Rows.Count > 0)
            {
                DataRow r = tblSysCtrl.Rows[0];
                txtVATCenter.Text = r["Curr_VAT_Center"].ToString();
                txtDateFrom.Text = DateTime.Parse(r["Curr_start_extractDate"].ToString()).ToShortDateString();
                txtDateTo.Text = DateTime.Parse(r["Curr_end_extractDate"].ToString()).ToShortDateString();
            }


            lst_Check_Amount_Tally.DataSource = bindingSource1;
            bindingSource1.DataSource = bao.get_DataSource("select * from qCheck_Amount_Tally");
            bindingSource1.ResetBindings(false);

            formatCells();
        }

        private void formatCells()
        {
            if (lst_Check_Amount_Tally.DataSource != null)
            {
                lst_Check_Amount_Tally.Columns["SumOfAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                lst_Check_Amount_Tally.Columns["Amount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                lst_Check_Amount_Tally.Columns["diff"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            }
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {

        }       

    }
}